home *** CD-ROM | disk | FTP | other *** search
/ Aminet 37 / Aminet 37 (2000)(Schatztruhe)[!][Jun 2000].iso / Aminet / dev / lang / sofa.lha / sofa / smalleiffel / lib_se / call_infix1.e < prev    next >
Text File  |  2000-03-25  |  5KB  |  158 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr
  4. --                       http://SmallEiffel.loria.fr
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License
  11. -- for  more  details.  You  should  have  received a copy of the GNU General
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. deferred class CALL_INFIX1
  17.  
  18. inherit CALL_INFIX;
  19.  
  20. feature
  21.  
  22.    run_feature: RUN_FEATURE;
  23.  
  24. feature {NONE}
  25.  
  26.    frozen with(t: like target; fn: like feature_name; a: like arguments;
  27.         rf: RUN_FEATURE; ct: TYPE) is
  28.       require
  29.          t /= Void;
  30.          fn /= Void;
  31.          a.count = 1;
  32.          rf /= Void;
  33.          ct /= Void
  34.       do
  35.          target := t;
  36.          feature_name := fn;
  37.          arguments := a;
  38.          run_feature := rf;
  39.          run_feature_match(ct);
  40.       ensure
  41.          target = t;
  42.          feature_name = fn;
  43.          arguments = a;
  44.          run_feature = rf
  45.       end;
  46.  
  47. feature
  48.  
  49.    frozen result_type: TYPE is
  50.       local
  51.          tla: TYPE_LIKE_ARGUMENT;
  52.       do
  53.          Result := run_feature.result_type;
  54.          if Result.is_like_current then
  55.             Result := run_feature.current_type;
  56.          else
  57.             tla ?= Result;
  58.             if tla /= Void then
  59.                Result := arg1.result_type.run_type;
  60.             end;
  61.          end;
  62.       end;
  63.  
  64. feature {RUN_FEATURE_3,RUN_FEATURE_4}
  65.  
  66.    finalize is
  67.       local
  68.          rc: RUN_CLASS;
  69.          rf: RUN_FEATURE;
  70.       do
  71.          rf := run_feature;
  72.          rc := rf.current_type.run_class;
  73.          run_feature := rc.running.first.dynamic(rf);
  74.       end;
  75.  
  76. feature
  77.  
  78.    frozen to_runnable(ct: TYPE): like Current is
  79.       local
  80.          t: like target;
  81.          a: like arguments;
  82.          rf: RUN_FEATURE;
  83.          argument_type, target_type: TYPE;
  84.       do
  85.          t := runnable_expression(target,ct);
  86.          a := runnable_args(arguments,ct);
  87.          target_type := t.result_type;
  88.          argument_type := arg1.result_type;
  89.          if argument_type.is_real then
  90.             if target_type.is_integer then
  91.                t := conversion_handler.implicit_cast(t,argument_type);
  92.             end;
  93.          elseif argument_type.is_double then
  94.             if target_type.is_integer or else target_type.is_real then
  95.                t := conversion_handler.implicit_cast(t,argument_type);
  96.             end;
  97.          end;
  98.          rf := run_feature_for(t,ct);
  99.          if run_feature = Void then
  100.             target := t;
  101.             arguments := a;
  102.             run_feature := rf;
  103.             run_feature_match(ct);
  104.             Result := Current;
  105.          elseif t = target and then a = arguments then
  106.             check
  107.                run_feature = rf
  108.             end;
  109.             Result := Current;
  110.          else
  111.             !!Result.with(t,feature_name,a,rf,ct);
  112.          end;
  113.       end;
  114.  
  115. feature
  116.  
  117.    frozen assertion_check(tag: CHARACTER) is
  118.       do
  119.          if tag = 'R' then
  120.             run_feature.vape_check_from(start_position);
  121.          end;
  122.          target.assertion_check(tag);
  123.          arg1.assertion_check(tag);
  124.       end;
  125.  
  126.    frozen static_value: INTEGER is
  127.       do
  128.          Result := static_value_mem;
  129.       end;
  130.  
  131. feature {NONE}
  132.  
  133.    static_value_mem: INTEGER;
  134.  
  135.    frozen call_is_static: BOOLEAN is
  136.       local
  137.          rc: RUN_CLASS;
  138.          running: ARRAY[RUN_CLASS];
  139.          rf: like run_feature;
  140.       do
  141.          if run_feature /= Void then
  142.             rc := run_feature.run_class;
  143.             if rc /= Void then
  144.                running := rc.running;
  145.                if running /= Void and then running.count = 1 then
  146.                   rf := running.first.dynamic(run_feature);
  147.                   if rf.is_static then
  148.                      static_value_mem := rf.static_value_mem;
  149.                      Result := true;
  150.                   end;
  151.                end;
  152.             end;
  153.          end;
  154.       end;
  155.  
  156. end -- CALL_INFIX1
  157.  
  158.